package com.zc.manager.notify.service;

import com.zc.component.notify.core.NotifierProperties;
import com.zc.component.notify.core.NotifyConfigManager;
import com.zc.component.notify.core.NotifyType;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

import javax.annotation.Nonnull;
import javax.annotation.Resource;

@Service
public class DefaultNotifyConfigManager implements NotifyConfigManager {

    @Resource
    private NotifyConfigService notifyConfigService;

    @Nonnull
    @Override
    public Mono<NotifierProperties> getNotifyConfig(@Nonnull NotifyType notifyType, @Nonnull String configId) {
        Mono<NotifierProperties> mono =
                Mono.just(notifyConfigService.selectNotifyConfigById(Long.valueOf(configId) ).toProperties());
      return mono;
    }
}
